package com.rover12421.zkm.asm

import org.objectweb.asm.ClassReader
import org.objectweb.asm.ClassWriter
import java.nio.file.Files
import java.nio.file.Paths

/**
 * 只有 FRAME 不同，这个不影响
 */
fun main(args: Array<String>) {
    val inClazzPath = Paths.get("zkm/ZKM.class")
    val outClazzPath = Paths.get("zkm/ZKM.out.class")

    val inBytes = Files.readAllBytes(inClazzPath)

    val cr = ClassReader(inBytes)
    val cn = ZkmClassNode()
//    val cn = ClassNode()
    cr.accept(cn, 0)

    val cw = ClassWriter(cr, ClassWriter.COMPUTE_MAXS or ClassWriter.COMPUTE_FRAMES)
    cn.accept(cw)

    Files.write(outClazzPath, cw.toByteArray())
}